" 在Normal模式下调用此函数，会在光标位置之后插入当前的时间字符串。
function! utils#inserts#InsertCurrentTime()
    let current_time = strftime("%Y-%m-%d %H:%M:%S")
    execute "normal! a" . current_time
endfunction

function! utils#inserts#InsertLineNumbers(pattern) range
    let pattern = strlen(a:pattern) == 0 ? '%2d. ' : a:pattern

    let line = a:firstline
    let index = 1
    while line <= a:lastline
        if !std#string#IsBlank(getline(line))
            execute line."s/^/\\=printf(pattern, index)"
            let index = index + 1
        endif
        let line = line + 1
    endwhile
    echo 'InsertLineNumbers 0'
endfunction
